package com.zhoutao123.hephaestus.object.transport;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.zhoutao123.hephaestus.repository.entity.BlogLook;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.Date;
import java.util.UUID;

@Data
@Accessors(chain = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class BlogLookTO {

  private String blogId;

  private String userIp;

  private Date lookTime;

  public BlogLook toEntity() {
    BlogLook blogLook = new BlogLook();
    blogLook.setId(UUID.randomUUID().toString());
    blogLook.setBlogId(blogId);
    blogLook.setUserIp(userIp);
    blogLook.setLookTime(lookTime);
    blogLook.setCreateTime(new Date());
    return blogLook;
  }
}
